<template>
	<view>
		<view class="main" style="padding: 20rpx;">
			<view class="title"
				style="border: 2rpx solid #dcdfe6; border-radius: 20rpx;height: 180rpx; padding: 20rpx;">
				<textarea placeholder="请输入标题" style="width: 100%; height: 100%;" v-model="title"></textarea>
			</view>
			<view class="content"
				style="border-radius: 20rpx; border: 2rpx solid #dcdfe6; height: 400rpx; padding: 20rpx; margin-top: 80rpx;">
				<textarea placeholder="请输入反馈内容" style="width: 100%; height: 100%;" v-model="content"></textarea>
			</view>
			<button @click="submit" style="width: 180rpx; height: 80rpx; padding: 20rpx;display: flex;align-items: center;justify-content: center;color: white;margin-top: 80rpx;"
			:class="title === '' || content === '' ? 'disabled' : ''">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				content: ''
			}
		},
		methods: {
			submit(){
				uni.request({
					url:this.$baseurl + '/prod-api/api/common/feedback',
					method: 'POST',
					header:{Authorization: uni.getStorageSync('token')},
					data:{
						title: this.title,
						content: this.content
					},
					success: (res) => {
						console.log(res)
						this.title = ''
						this.content = ''
						uni.showToast({
							title:'提交成功'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	view{
		.main{
			button{
				background-color: #2979ff;
			}
			.disabled{
				background-color: #c8c9cc;
			}
		}
	}
</style>